﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LX.Core
{
    public partial class Calculate
    {
        public static decimal? DivideDecimal(int? value1, int? value2)
        {
            if (value1 == null ||  value2 == null || value2.Value == 0)
            {
                return null;
            }
            return value1.Value / value2.Value;
        }

        public static decimal? DivideDecimal(decimal? value1, int? value2)
        {
            if (value1 == null || value2 == null || value2.Value == 0)
            {
                return null;
            }
            return value1.Value / value2.Value;
        }

        public static decimal? DivideDecimal(decimal? value1, decimal? value2)
        {
            if (value1 == null || value2 == null || value2.Value == 0)
            {
                return null;
            }
            return value1.Value / value2.Value;
        }

        public static decimal? DivideDecimal(int? value1, decimal? value2)
        {
            if (value1 == null || value2 == null || value2.Value == 0)
            {
                return null;
            }
            return value1.Value / value2.Value;
        }

        public static int? Divide(int? value1, int? value2)
        {
            if (value1 == null || value2 == null || value2.Value == 0)
            {
                return null;
            }
            return value1.Value / value2.Value;
        }

        public static int? Divide(decimal? value1, int? value2)
        {
            if (value1 == null || value2 == null || value2.Value == 0)
            {
                return null;
            }
            return (int)(value1.Value / value2.Value);
        }

        public static int? Divide(decimal? value1, decimal? value2)
        {
            if (value1 == null || value2 == null || value2.Value == 0)
            {
                return null;
            }
            return (int)(value1.Value / value2.Value);
        }

        public static int? Divide(int? value1, decimal? value2)
        {
            if (value1 == null || value2 == null || value2.Value == 0)
            {
                return null;
            }
            return (int)(value1.Value / value2.Value);
        }
    }
}
